package com.chris.seata_app.service;

import com.alibaba.dubbo.config.annotation.Reference;
import com.chris.seata_facade.OrderFacade;
import com.chris.seata_facade.StockFacade;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.stereotype.Service;

/**
 * @author wujf
 * @date 2022/1/20
 */
@Service
public class TestService {

    @Reference
    private OrderFacade orderFacade;

    @Reference
    private StockFacade stockFacade;

    @GlobalTransactional(rollbackFor = Exception.class)
    public boolean test01() {
        orderFacade.createOrder();
        int i = 1 / 0;
        stockFacade.updateStock();
        return Boolean.TRUE;
    }

}
